/**
 * Created by haoli on 3/13/14.
 */
var connection = require('../db/mysql');
var dbconf = require('../conf/dataconfige');
var table = dbconf.prefix+"qappvote";

function QappVote( vote ){
    this.id = vote.id
    this.vote_name = vote.vate_name;
    this.survey_id = vote.survey_id;
    this.description = vote.description;
    this.vote_type = vote.vote_type;
    this.vote_number = vote.vote_number;
    this.max_val = vote.max_val;
    this.min_val = vote.min_val;
    this.option_number = vote.option_number;
    this.fromdate = vote.fromdate;
    this.todate = vote.todate;
    this.username = vote.username;
    this.createtime = vote.createtime;
    this.updatetime = vote.updatetime;
    this.createtime = vote.createtime;
    this.checked = vote.checked;
    this.listorder = vote.listorder;
    this.status = vote.status;
    this.vote_img = vote.vote_img;
}

module.exports = QappVote;

QappVote.prototype.getQappVoteById = function( callback ){
    sqlStr = "select * from "+ table + " where id = " + this.id;
    connection.query(sqlStr,function(err,result){
        if( err ){
        }else{
            callback( err,result );
        }
    });
}




